package com.cgw.game.ui;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.view.View;

import com.cgw.game.R;
import com.cgw.game.view.DashboardView;

public class DashboardActivity extends AppCompatActivity {
    private DashboardView dashboard;
    private String[] conten = new String[]{
        "中","7647","优","123","89","优","优","偏高"
    };
    private String[] company = new String[]{
        "","步","","次/分","%","","",""
    };
    private String[] bottom = new String[]{
        "9小时09分","目标完成度 98%","睡眠-觉醒节律正常","心率正常","轻度低血氧症","198分","反应时间 243ms","90~120ms"
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dashboard);
        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setTitle(getIntent().getStringExtra("title"));
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);//左侧添加一个默认的返回图标
        getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();//返回
            }
        });
        dashboard = findViewById(R.id.dashboard);
        dashboard.setValue(conten[0],bottom[0]);
        dashboard.setListener(new DashboardView.OnTitleClickListener() {
            @Override
            public void onTouchPos(int pos) {
                dashboard.setValue(conten[pos],company[pos],bottom[pos]);
            }
        });
    }
}
